package cn.cs.service.impl;

import cn.cs.client.RestInvoiceTitleClient;
import cn.cs.pojo.InvoiceTitle;
import cn.cs.service.InvoiceTitleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class InvoiceTitleServiceImpl implements InvoiceTitleService {

    @Resource
    private RestInvoiceTitleClient invoiceTitleClient;

    public InvoiceTitle getInvoiceTitleById(Long id)throws Exception{
        return invoiceTitleClient.getInvoiceTitleById(id);
    }

    public InvoiceTitle	getInvoiceTitleByName(String name, String userId)throws Exception{
        return invoiceTitleClient.getInvoiceTitleByName(name, userId);
    }

    public List<InvoiceTitle> getInvoiceTitleListByUserId(String userId)throws Exception{
        return invoiceTitleClient.getInvoiceTitleListByUserId(userId);
    }

    public Integer addInvoiceTitle(InvoiceTitle invoiceTitle)throws Exception{
            invoiceTitle.setCreateDate(new Date());
            return invoiceTitleClient.addInvoiceTitle(invoiceTitle);
    }

    public Integer modifyInvoiceTitle(InvoiceTitle invoiceTitle)throws Exception{
        invoiceTitle.setModifyDate(new Date());
        return invoiceTitleClient.modifyInvoiceTitle(invoiceTitle);
    }

    public Integer deleteInvoiceTitleById(Long id)throws Exception{
        return invoiceTitleClient.deleteInvoiceTitleById(id);
    }

    public Integer setDefault(Long id)throws Exception{
        return invoiceTitleClient.setDefault(id);
    }

    public Integer setDefaultAll(String userId)throws Exception{
        return invoiceTitleClient.setDefaultAll(userId);
    }

    public InvoiceTitle getDefaultByUserId(String userId)throws Exception{
        return invoiceTitleClient.getDefaultByUserId(userId);
    }



}
